package com.neuedu.hcp.service.impl;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.neuedu.hcp.entity.Distribute;
import com.neuedu.hcp.entity.RespPageBean;
import com.neuedu.hcp.mapper.DistributeMapper;
import com.neuedu.hcp.service.IDistributeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 第八组
 * @since 2021-04-26
 */
@Service
public class DistributeServiceImpl extends ServiceImpl<DistributeMapper, Distribute> implements IDistributeService {

    @Autowired
    private DistributeMapper distributeMapper;

    @Override
    public RespPageBean getPlanListByPage(Integer currentPage, Integer size, Distribute distribute) {
        Page<Distribute> page = new Page<>(currentPage,size);
        IPage<Distribute> distributeByPage =distributeMapper.getPlanListByPage(page,distribute);
        RespPageBean respPageBean = new RespPageBean(distributeByPage.getTotal(),distributeByPage.getRecords());
        return respPageBean;
    }

    @Override
    public int insert(Distribute distribute) {
        return distributeMapper.insert(distribute);
    }
}
